<%@ page import="com.entity.User" %>
<%@ page pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <c:url var="base" value="/"/>
    <base href="${base}">
    <meta charset="UTF-8">
    <title>新闻公告</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        .area .row a{
            text-decoration: none;
            color: #396898;
        }
        .area .row a:hover{
            color: #5bd1e1;
        }
        ul,li{
            list-style: none;
            padding: 10px 0;
        }
        .clear{
            clear: both;
        }
        .area{
            background: rgba(229, 239, 255, 0.9);
            padding: 20px;
            margin-top: 20px;
        }
        .main{
            width: 60%;
            margin-left: 20%;
        }
        .blank{
            height: 30px;
        }
        p{
            font-size: 20px;
        }
        .row{
            display: block;
            border:2px solid black;
            margin:1px;
            background-color: #ffffff;
        }
        .row:hover{
            transform: scale(1.01,1.01);
            transition-duration: 0.05s;
        }
        .part{
            width: 30%;
            display: inline-block;
            overflow: hidden;
            word-break:keep-all;
            white-space:nowrap;
            -webkit-line-clamp: 1;
            -webkit-box-orient:vertical;
            text-overflow: ellipsis;
            padding:2px;
        }
        .parts{
            text-align: right;
        }
        .part br{
            display: none;
        }
        .head{
            font-weight: bold;
            letter-spacing: 3px;
        }
        .btn {
            border: 1px black solid;
            display: inline-block;
            background-color: #23a9ff;
            color: white;
            padding: 5px 15px;
            text-decoration: none;
            border-radius: 5px;
        }
        .btn:hover{
            background-color: #617581;
        }
    </style>
</head>
<body>
<div class="container">
    <div>
        <%@include file="/WEB-INF/jsp/nav.jsp" %>
    </div>
    <div>
        <%@include file="/WEB-INF/jsp/logbutton.jsp" %>
    </div>
    <div class="blank"></div>
    <div class="main">
        <div class="clear area">
            <h2 style="display: inline-block;letter-spacing: 5px;">新闻公告</h2>
            <% User manager=(User)session.getAttribute("user"); if(manager!=null){%>
            <a class="btn" href="newsmanage">后台管理</a><span style="opacity: 0.5">(仅管理员可见)</span>
            <%} %>
            <div class="blank"></div>
            <div>
                <div class="part head">标题</div>
                <div class="part head">内容</div>
                <div class="part parts head">发布/更新时间</div>
            </div>
        <c:forEach items="${items2}" var="w">
            <div class="row"><a href="news?uid=${w.id}">
                <div class="part">${w.name}</div>
                <div class="part">${w.content}</div>
                <div class="part parts">${w.date}</div>
            </a></div>
        </c:forEach>
        </div>
    </div>
    <div>
        <%@include file="/WEB-INF/jsp/footer.jsp" %>
    </div>
</div>
</body>
</html>